package creators;

import java.util.Scanner;

import physicalobjects.PhysicalObject;

import simulationhandlers.Simulation;

/**
 * Super class for all creators.
 * @author Kathleen Lan, Seon Kang
 */

public abstract class Creator {

    private Scanner myLine;
    private int myAssemblyNumber;
    private Simulation mySimulation;
    private String myName = "Creator";

    /**
     *
     * @param sim 
     * @param assemblyNumber 
     */
    public Creator (Simulation sim, int assemblyNumber) {

        myAssemblyNumber = assemblyNumber;
        mySimulation = sim;
    }

    /**
     * @param line 
     */
    public void addMass (Scanner line) {
        myLine = line;
        mySimulation.add(createMyObject(), myAssemblyNumber);
    }
    /**
     * 
     * @return
     */
    public abstract PhysicalObject createMyObject();
    /**
     * 
     * @return
     */
    public Simulation getSimulation() {
        return mySimulation;
    }
    /**
     * 
     * @return
     */
    public int getAssemblyNumber() {
        return myAssemblyNumber;
    }
    /**
     * 
     * @return
     */
    public int scannerNextInt() {
        return myLine.nextInt();
    }
    /**
     * 
     * @return
     */
    public double scannerNextDouble() {
        return myLine.nextDouble();
    }
    /**
     * 
     * @return
     */
    public boolean scannerHasNextDouble() {
        return myLine.hasNextDouble();
    }
    /**
     * 
     * @return
     */
    public String getName () {
        return myName;
    }

    /**
     * 
     * @param s 
     */
    public void setName (String s) {
        myName = s;
    }
}
